package com.zbkj.dal.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum UserIdentityEnums {

    MEMBER("MEMBER", "会员"),
    STORE_MANAGER("STORE_MANAGER", "店长"),
    DYNAMIC_STORE_MANAGER("DYNAMIC_STORE_MANAGER", "动态店长"),


    ;
    private final String code;
    private final String desc;

    public static String getDescByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        return Arrays.stream(UserIdentityEnums.values()).filter(e -> StringUtils.equals(e.getCode(), code)).map(UserIdentityEnums::getDesc).findFirst().orElse(null);
    }

}
